Козельских_ДЗ первой недели#37
Open
gipercube wants to merge 3 commits intoRTF-TypeScript-2021:devfrom
Open
Conversation
flashart92
reviewed
Oct 7, 2021
| function isTriangle(a, b, c) { | ||
| isTriangle(7, 2, 2) | ||
| function isTriangle(a, b, c) { | ||
| if (a + b > c && a + c > b && b + c > a) { |
There was a problem hiding this comment.
3 целочисленных значения
добавить валидацию входных аргументов
| calculateDoubleArray(array) | ||
|
|
||
| function calculateDoubleArray(array) { | ||
| for (let i = 0; i < array.length; i++) { |
There was a problem hiding this comment.
добавить проверку входного массива на корректность
| i++ | ||
| } | ||
| } | ||
| return array |
There was a problem hiding this comment.
calculateDoubleArray([1, 2, 3, 4, 5]) - вернёт тот же результат что и [1, 2, 3, 4, 5, 0, 0, 0, 0, 0].
Добавить логику проверки для свободных ячеек.
| */ | ||
|
|
||
| function factorial(n) { | ||
| if (n > 0) { |
There was a problem hiding this comment.
нет проверки, что входной аргумент число, и что оно целое
| * */ | ||
|
|
||
| function countUniqueName(nameArray) { | ||
|
|
| function kaprekarConstant(number){ | ||
|
|
||
| function kaprekarConstant(number) { | ||
| let countDigits = number.toString().length; |
There was a problem hiding this comment.
kaprekarConstant(2223) - зависает. Добавить обработку входных данных
| throw new Error('Число не должно состоять из одинаковых цифр.') | ||
| } | ||
| } else { | ||
| throw new Error('Число не из 4-х цифр.') |
There was a problem hiding this comment.

думаю можно уточнить условие проверки)
https://www.dcode.fr/kaprekar-algorithm - я тестил тут
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

No description provided.